#pragma once

#include <unordered_map>
#include "../share/user_define.h"
#include "../../3rd/libjson/json.h"

static const uint32_t NameStrLen = 32;
static const uint32_t size_256 = 256;

struct UInt32_5x
{
	uint32_t mValue[5];
};

struct Skill
{
	uint32_t mId;
	char mName[NameStrLen];
	uint32_t mHeroId;
	char mSkillName[NameStrLen];
	char mDes[size_256];
	char mSkillIcon[NameStrLen];
	char mSkillMotion[NameStrLen];
	char mSound[NameStrLen];
	char mHitSound[NameStrLen];
	uint32_t mTargetCeiling;
	uint32_t mSkillType;
	uint32_t mInfluenceType;
	
	uint32_t mTypes;
/*
	"target_ceiling":0,
		"skill_type" : 10,
		"influence_type" : [3, 4],
		"nullity_type" : [1],
		"pierce through" : 0,
		"range_type" : 0,
		"aoe_long" : 1,
		"aoe_wide" : 0,
		"angle" : 360,
		"types" : 2,
		"dist" : 2,
		"flight_speed" : 0,
		"max_fly" : 0,
		"singular_aoe" : 1,
		"interval_time" : [0.3, 0.8],
		"site" : 3,
		"energy" : 0,
		"target" : 1,
		"missable" : 0,
		"effect_time" : 0,
		"cooling" : 8,
		"add_state" : [[401000200, 2]],
		"base_num1" : [5, 20],
		"growth_ratio1" : [7, 0.3],
		"skill_ratio" : [0.8, 0],
		"stats" : [5, 0]
		*/

	Skill()
	{
		Clear();
	}

	void Clear(void)
	{

	}
};

class SkillCacheData
{
public:

	static void CreateInstance(void);
	static SkillCacheData* GetInstance(void);

	~SkillCacheData(void);

public:

	bool Initialization(void);

	bool Reload(void);

	Skill* GetData(uint32_t id);

	bool GetDataJsonString(uint32_t id, Json::Value& _jm);

	uint32_t GetDataCount(void);

private:
	SkillCacheData(void);

	void Clear(void);

	void AddData(uint32_t id, Json::Value& jm);


private:

	static SkillCacheData* mInstance;

	std::unordered_map<uint32_t, Skill*> m_mapCacheData;
	uint32_t m_maxCount;

};